package com.lsa.google.trials;

public class Task1SkippedMulCalc
{ 
    public static int[] calc(int[] arr)
    {
        //int[] array = new int[]{1,2,3,4,5};
        // 2 have {2*3*4*5, 1*3*4*5, 1*2*4*5, 1*2*3*5, 1*2*3*4}
        // int[] out1 = new int[]{1, 1*1, 1*2, 1*2*3, 1*2*3*4};
        // int[] out2 = new int[]{,}
        
        int[] out = new int[arr.length];
        
        int prod = 1;
        
        for( int i = 0; i < arr.length; i++ )
        {
            out[i] = prod;
            prod *= arr[i];
        }
        
        prod = 1;
        
        for( int i = arr.length - 1; i > -1; i-- )
        {
            out[i] *= prod;
            prod *= arr[i];
        }
        
        return out;
    }
}
